﻿<Window x:Class="WPFXMPPClient.ChatWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        AllowsTransparency="True" WindowStyle="None"
        xmlns:local="clr-namespace:WPFXMPPClient"
        MouseDown="Window_MouseDown" ResizeMode="CanResizeWithGrip"
        Title="{Binding}"  Width="617" Height="420" MinHeight="200" Loaded="Window_Loaded" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" WindowStartupLocation="CenterOwner">
    
    <Window.Background>
        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
            <GradientStop Color="#FFBBFF81" Offset="0"/>
            <GradientStop Color="#FFEEFFDF" Offset="1"/>
        </LinearGradientBrush>
    </Window.Background> 


    <Border BorderBrush="Black" BorderThickness="1" CornerRadius="2" >

        <Grid x:Name="LayoutRoot" Background="Transparent">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>

			<Border Grid.Row="0"  BorderThickness="1">
				<Border.BorderBrush >
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="Black" Offset="0"/>
						<GradientStop Color="Gray" Offset="1"/>
					</LinearGradientBrush>
				</Border.BorderBrush>
			</Border>
				
             <Grid Margin="0,5" Grid.Row="0" >
                <Grid.ColumnDefinitions>
                    <!--<ColumnDefinition Width="30" />-->
                    <ColumnDefinition Width="76*" />
                    <ColumnDefinition Width="357*" />
                    <ColumnDefinition Width="40" />
                    <ColumnDefinition Width="40" />
                    <ColumnDefinition Width="40" />
                    <ColumnDefinition Width="40" />
                    <ColumnDefinition Width="40" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="23" />
                    <RowDefinition Height="40" />
                    <RowDefinition Height="30" />
                </Grid.RowDefinitions>

                <TextBlock FontWeight="Normal" FontSize="14" Margin="10,0" Grid.ColumnSpan="2">
                   <TextBlock.Inlines>
                        <Run Text="Conversation with" FontWeight="SemiBold" />
                        <Run Text="{Binding Path=Name, Mode=OneWay}" FontWeight="Bold" />
                        </TextBlock.Inlines>
                </TextBlock>

                <Rectangle Fill="{Binding Presence.PresenceBrush}"  Width="60" Height="60" Grid.Column="0" Grid.Row="1" Grid.RowSpan="2" />
                <Image Grid.Column="0" Grid.Row="1" Grid.RowSpan="2" Width="58" Height="58" Source="{Binding Avatar}" />


                <ListBox x:Name="ListBoxInstances" Background="{x:Null}" BorderBrush="{x:Null}" DataContext="{Binding}"
                        ItemsSource="{Binding ClientInstances}" Grid.Row="1" Grid.Column="1" SelectionMode="Extended" Grid.RowSpan="2" Grid.ColumnSpan="1">
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal">
                                <Ellipse Width="20" Height="20" >
                                    <Ellipse.Fill>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="#FF000E0E" Offset="1"/>
                                            <GradientStop Color="{Binding Path=Presence.PresenceColor}"/>
                                        </LinearGradientBrush>
                                    </Ellipse.Fill>
                                    <Ellipse.Stroke>
                                        <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                            <GradientStop Color="White" Offset="0"/>
                                            <GradientStop Color="{Binding Path=Presence.PresenceColor}" Offset="1"/>
                                        </LinearGradientBrush>
                                    </Ellipse.Stroke>
                                </Ellipse>

                                <TextBlock FontWeight="Normal" FontSize="12" Margin="10,0">
                                    <TextBlock.Inlines>
                                        <Run Text="{Binding Path=FullJID, Mode=OneWay}" />
                                    </TextBlock.Inlines>
                                </TextBlock>

                                <Button Visibility="{Binding VisibilityCanClientDoAudio}" Background="#AAEEFFEE" BorderBrush="{x:Null}" HorizontalAlignment="Stretch" ToolTip="Start an Audio Call" Grid.Row="0" Grid.Column="3" x:Name="ButtonStartAudioCall" Click="ButtonStartAudioCall_Click"   HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                                    <Image  Source="Images/volume.png" Width="20" Height="20" />
                                </Button>

                            </StackPanel>
                            
                            
                            
                        </DataTemplate>
                    </ListBox.ItemTemplate>
                </ListBox>




                <CheckBox x:Name="CheckBoxUseSpeech" Grid.Column="1" HorizontalAlignment="Right" IsChecked="True">Speak</CheckBox>
                <Button Style="{DynamicResource ButtonSurface}" ToolTip="Send File" Grid.Column="2" x:Name="ButtonSendFile" Click="ButtonSendFile_Click"  Height="40" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="0" Grid.RowSpan="2">
                    <Image Source="Images/mail - copy.png" Width="20" Height="20" VerticalAlignment="Center" Margin="0" />
                </Button>

                <Button Style="{DynamicResource ButtonSurface}" ToolTip="Screen Capture" Grid.Column="3" x:Name="ButtonSendScreenCapture" Click="ButtonSendScreenCapture_Click"  Height="40" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="0" Grid.RowSpan="2">
                    <Image Source="Images/photo - crop.png" Width="20" Height="20" VerticalAlignment="Center" Margin="0" />
                </Button>

                <Button Grid.Column="4" Grid.RowSpan="2" Background="{StaticResource ButtonBrush}" 
                        HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
                        VerticalAlignment="Center" x:Name="ButtonSendPhotoCapture" 
                        Click="ButtonSendPhotoCapture_Click" Width="40" Height="40"  RenderTransformOrigin=".5,.5" 
                        Style="{StaticResource {x:Static ToolBar.ButtonStyleKey}}" ToolTip="Capture a photo and send it" >
                    <Button.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Button.RenderTransform>
                    <Rectangle Stretch="UniformToFill" Fill="{DynamicResource camera}" Width="28" Height="28" />
                </Button>


                <Button Style="{DynamicResource ButtonSurface}" ToolTip="Clear" Grid.Column="5" x:Name="ButtonClear" Click="ButtonClear_Click"  Height="40" Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="0" Grid.RowSpan="2">
                    <Image Source="Images/trash.png" Width="20" Height="20" VerticalAlignment="Center" Margin="0" />
                </Button>

                <Button Style="{DynamicResource ButtonSurface}" ToolTip="Close" Grid.Column="6" x:Name="ButtonClose" Click="ButtonClose_Click"  Height="40"  Padding="0" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Grid.Row="0" Grid.RowSpan="2">
                    <Image Source="Images/calculator - multiply.png" Width="30" Height="20" VerticalAlignment="Center" Margin="0" />
                </Button>
            </Grid>

            <TabControl Grid.Row="1" Margin="5" x:Name="TabControlThreads" SelectionChanged="TabControlThreads_SelectionChanged">
                <TabItem Header="Main Thread">
                    <local:DialogControl Grid.Row="1" Grid.ColumnSpan="4" BorderBrush="{x:Null}" Foreground="{x:Null}" Background="{x:Null}" x:Name="DialogControlLastMessage" ></local:DialogControl>
                </TabItem>
                <TabItem Header=" + " Visibility="Collapsed">
                    <local:DialogControl Grid.Row="1" Grid.ColumnSpan="4" BorderBrush="{x:Null}" Foreground="{x:Null}" Background="{x:Null}" x:Name="DialogControlNewThreadTab" ></local:DialogControl>
                </TabItem>
                
            </TabControl>
            <!--<s:SurfaceListBox SelectionMode="Multiple" Grid.Row="1" Margin="3,0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" 
                 DataContext="{Binding Conversation}" Background="Beige" x:Name="ListBoxConversation">
                <s:SurfaceListBox.ItemTemplate>
                    <DataTemplate>

                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="*" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>

                            <TextBlock Grid.Row="0">
                            <TextBlock.Inlines>
                                <Run Text="{Binding Path='RemoteEnd'}" Foreground="Gray" FontSize="8" />
                                <Run Text="{Binding Received}" Foreground="Gray" FontSize="8" />
                            </TextBlock.Inlines>
                            </TextBlock>
                            <TextBlock Grid.Row="1" TextWrapping="Wrap" Text="{Binding Path=Message}" Foreground="{Binding TextColor}" />
                        </Grid>

                    </DataTemplate>
                </s:SurfaceListBox.ItemTemplate>

            </s:SurfaceListBox>-->


            <Grid Grid.Row="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="80*" />
                    <ColumnDefinition Width="60" />
                </Grid.ColumnDefinitions>
                <TextBox Grid.Column="0"  x:Name="TextBoxChatToSend" PreviewKeyDown="TextBoxChatToSend_PreviewKeyDown" AcceptsReturn="True" MaxLines="50000" MaxHeight="38"></TextBox>
                 <Button Style="{DynamicResource ButtonSurface}" ToolTip="Send Message" Grid.Column="1"  x:Name="ButtonSend" Click="ButtonSend_Click" FontWeight="Normal" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" >
                    <Image Width="20" Height="20" Source="Images/mail.png" />
                </Button>
            </Grid>

        </Grid>

    </Border>
</Window>
